---
title: LegalManagerBase
summary: API reference for LegalManagerBase.
status: draft
owner: SAIF Claims BOF team
last_reviewed: 2026-08-21
library: SAIF.Application.Claim.Legal
reference_type: embedded
---

# LegalManagerBase

`LegalManagerBase` is the `MustInherit` application-manager base that every Legal AppManager (`clsMaintenanceManager`, `clsAttorneyTableManager`, `clsScheduleManager`, `clsRequestManager`, and the other 19 concrete managers) inherits from. It centralizes the case-context lifecycle (`SetCurrentCase`/`CreateCase`/`OnContextChanged`), the claim-visibility security gate that runs at the top of every retrieval ([Business rules](../../business-rules.md)), consolidated-case propagation of status/LCE/file-location/DEF-sent state across secondary cases, and a direct (non-business-layer) stored-procedure call used to insert letter requests. It extends `ClaimAppManager` (`SAIF.Application.Claim`), which in turn resolves to the framework `clsBusinessBase` lifecycle.

## Purpose
- Load and switch the current legal case context, coordinating `clsFindCase`/`clsLegalCase` lookups in `SAIF.Business.Claim.Legal` with the inherited `ClaimAppManager` claim context.
- Enforce claim-visibility restrictions during `OnRetrieve()` — admin bypass, worker-conflict, and exposure-flag checks — before case data is exposed to any concrete manager ([Business rules](../../business-rules.md)).
- Propagate primary-case state (file location, LCE due-date/excusal, case status, DEF-sent flag) to secondary consolidated cases so they remain in sync with the primary case ([Business rules](../../business-rules.md)).
- Insert letter-request records via a direct stored-procedure call (`pk80001_LEGALNET.insertLetterRequest`), shared by every concrete manager that generates a mailed letter (e.g. DEF letters, recon-request letters).

## Context
- Namespace: `SAIF.Application.Claim.Legal`
- Assembly/package: `SAIF.Application.Claim.Legal.dll` (embedded library, referenced via project reference by every concrete Legal AppManager and by the `Legal` web front end)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `New(inDatabase, inSecurityPrincipal)` | `Public Sub New(inDatabase As String, inSecurityPrincipal As clsSecurityPrincipal)` | Constructs the manager for a given database context and authenticated principal, calling into `ClaimAppManager.New(inSecurityPrincipal)` and setting `DataLayer.Database`/`DataLayer.DBUser = "LGN"` to select the Oracle connection context for this library's data access. |
| `SetCurrentCase(caseID)` | `Public Sub SetCurrentCase(caseID As Decimal)`* | Loads `clsLegalCase.GetLegalCase(DPI, caseID)` and the `clsLegalData` header (via `pk80001_legalNet.getHeader`) for the given case, making it the active case context. |
| `CreateCase()` | `Public Sub CreateCase()`* | Creates a new `clsLegalCase` via `clsLegalCase.NewLegalCase(DPI)`, copies the claim-level attorney-firm assignment onto it, and loads the associated `clsLegalData` header. |
| `OnContextChanged()` | `Protected Overrides Sub OnContextChanged()` | Looks up matching cases via `clsFindCase.GetCases`, sets the claim context, then calls `SetCurrentCase` when a case is found. |
| `OnRetrieve()` | `Protected Overrides Sub OnRetrieve()` | Runs the claim-visibility security gate — admin bypass, worker-conflict, and exposure checks — before exposing case data, per [Business rules](../../business-rules.md). |
| `IsInAdminGroup` | `Protected ReadOnly Property IsInAdminGroup As Boolean` | Indicates whether the current user is in the Legal admin security group (`LNAdmin`), granting a full claim-visibility bypass. |
| `HasLegalConflictAccess` | `Protected Function HasLegalConflictAccess() As Boolean`* | Evaluates the `LNConflict` security key to determine whether the current user may view worker-conflict claims. |
| `HasLegalExposureAccess` | `Protected Function HasLegalExposureAccess() As Boolean`* | Evaluates the `LNExposure` security key to determine whether the current user may view exposure-flagged claims. |
| `IsInCaseUpdateGroup` | `Protected ReadOnly Property IsInCaseUpdateGroup As Boolean` | Indicates whether the current user is in the case-update security group (`LNCaseUpdate`), used by managers such as `clsCaseNotesManager` to gate note edit/delete actions. |
| `IsInViewOnly` | `Protected ReadOnly Property IsInViewOnly As Boolean` | Exposes the `LNView` view-only role flag; no further gating logic consumes it within this library**. |
| `CheckForSecurityOverride()` | `Protected Function CheckForSecurityOverride() As Boolean`* | Checks for a security override that bypasses the conflict/exposure claim-visibility denial. |
| `insertLetterRequest(letterTypeCode, aLegalCaseNum, holdDate, createUser, aClaimId)` | `Protected Function insertLetterRequest(letterTypeCode As String, aLegalCaseNum As Decimal, holdDate As Date, createUser As String, aClaimId As Decimal) As Decimal`* | Executes `pk80001_LEGALNET.insertLetterRequest` and returns the generated letter-request sequence number; used by `clsScheduleManager.PrintDEF` and `clsRequestManager.OnWrite` (recon-request letters). |
| `updateConsolFileLocation()` | `Protected Sub updateConsolFileLocation()`* | Propagates the primary case's file location to each non-primary consolidated case, then saves each secondary case. |
| `updateConsolLCE()` | `Protected Sub updateConsolLCE()`* | Propagates the primary case's LCE due-date/excusal state to each secondary consolidated case. |
| `UpdateConsolCaseStatus()` | `Protected Sub UpdateConsolCaseStatus()`* | Propagates the primary case's status to each secondary consolidated case. |
| `UpdateConsolDEFFLag()` | `Protected Sub UpdateConsolDEFFLag()`* | Propagates the primary case's DEF-sent flag to each secondary consolidated case. |

## Inherited public members

Members in this section are inherited from `clsBusinessBase` in `SAIF.Framework.Core`, reached through the base-class chain `LegalManagerBase` → `ClaimAppManager` (`SAIF.Application.Claim`) → `AppManagerBase` (`SAIF.Application`) → `clsBusinessBase`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| `Rules` | `ReadOnly Property Rules As clsRulesManager` | Exposes the rule-tracking engine used to register and evaluate broken-rule checks via `Rules.CheckRules("RuleName")`.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `BeginEdit()` | `Sub BeginEdit()` | Opens an in-memory edit session, snapshotting object state so `CancelEdit()` can roll back to it.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `CancelEdit()` | `Sub CancelEdit()` | Rolls back any pending changes made since `BeginEdit()` was called.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `ApplyEdit()` | `Sub ApplyEdit()` | Commits pending edits made since `BeginEdit()`, clearing the rollback snapshot.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `Save()` | `Public Function Save() As Boolean` | Validates the object against registered rules, then dispatches the corresponding insert/update/delete path based on object state; throws `ApplicationException` if the target is read-only, mid-edit-session, or invalid after rule evaluation.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `OnWrite()` (base hook) | `Protected Overridable Function OnWrite() As Boolean` | Lifecycle hook invoked from `Save()`'s dispatch path; `LegalManagerBase` and its concrete subclasses override this to persist case-specific state.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `SetPreviousLink(item)` | `Sub SetPreviousLink(item As ILinkItem)` | Sets the predecessor pointer when this object participates in a linked business-object chain.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `SetNextLink(item)` | `Sub SetNextLink(item As ILinkItem)` | Sets the successor pointer when this object participates in a linked business-object chain.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `InsertLinkAfter(item)` | `Sub InsertLinkAfter(item As ILinkItem)` | Inserts an item immediately after this object in a linked business-object chain.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `InsertLinkBefore(item)` | `Sub InsertLinkBefore(item As ILinkItem)` | Inserts an item immediately before this object in a linked business-object chain.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `RemoveLinks()` | `Sub RemoveLinks()` | Detaches this object from its linked business-object chain.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `Error` | `ReadOnly Property Error As String` (via `IDataErrorInfo`) | Surfaces the aggregated broken-rule message for UI data-binding validation feedback.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `Item(columnName)` | `ReadOnly Property Item(columnName As String) As String` (via `IDataErrorInfo`) | Surfaces the broken-rule message scoped to a single bound field/column.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `DumpState()` | `Public Sub DumpState()` | Writes internal object state to a diagnostic/log sink for troubleshooting.† | `SAIF.Framework.Core` — `clsBusinessBase` |
| `AllowCache` | `Public Property AllowCache As Boolean` | Controls whether the data-portal layer may serve cached results for this object instead of re-querying.† | `SAIF.Framework.Core` — `clsBusinessBase` |

Note: `OnRetrieve()` is documented in the `Public members` table above as a local override rather than repeated here, per `Overrides <BaseClassName>.<MemberName>` convention.

## Behavioral notes
- `OnRetrieve()` is the single security choke point for every concrete manager: it runs before any manager-specific retrieval logic executes, so claim-visibility denial ([Business rules](../../business-rules.md)) is enforced uniformly across all 22 concrete managers.
- The four `updateConsol*` methods all follow the same pattern — iterate `CurrentCase.Consolidations`, load each secondary `clsLegalCase`, mutate the relevant field, and `Save()` it — enforcing that secondary cases mirror primary-case state ([Business rules](../../business-rules.md)).
- `insertLetterRequest` bypasses the business/`IBusinessCriteria` layer entirely and issues its stored-procedure call directly from this Application-tier class, an intentional exception to the normal business-object data-access pattern*.

## Constraints and usage notes
- `LegalManagerBase` is `MustInherit`; it has no independent runtime behavior without a concrete Legal AppManager subclass supplying manager-specific retrieval/save logic.
- All concrete subclasses share the `New(inDatabase As String, inSecurityPrincipal As clsSecurityPrincipal)` constructor signature, which this class defines and every subclass calls via `MyBase.New`.

> **Note:** Statements marked with `†` are derived from dependency library
> documentation via the Legends CLI. Statements marked with `*` were inferred
> from code structure or contextual evidence. Statements marked with `**` could
> not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Application.Claim.Legal\LegalManagerBase.vb`
